﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TalentPool.master" Inherits="WebManager.BasePage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Import Namespace="TalentPools.BLL" %>
<%@ Import Namespace="WebManager" %>
<%@ Import Namespace="TalentPools.Model" %>
<script runat="server">
    private int PageSize = 20;
    private int pageIndex;

    public int PageIndex
    {
        get { return Convert.ToInt32(ViewState["pageIndex"]); }
        set { ViewState["pageIndex"] = value; }
    }
    private string workCata;

    public string WorkCata
    {
        get { return ViewState["workCata"].ToString(); }
        set { ViewState["workCata"] = value; }
    }
    private string workArea;

    public string WorkArea
    {
        get { return ViewState["workArea"].ToString(); }
        set { ViewState["workArea"] = value; }
    }
    private string workYear;

    public string WorkYear
    {
        get { return ViewState["workYear"].ToString(); }
        set { ViewState["workYear"] = value; }
    }
    private string keyword;

    public string Keyword
    {
        get { return ViewState["keyword"].ToString(); }
        set { ViewState["keyword"] = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                ViewState["PreviousPage"] = Request.UrlReferrer.AbsoluteUri;
            }
            catch
            {
                ViewState["PreviousPage"] = null;
            }
            if (ViewState["PreviousPage"] == null)
            {
                Response.Redirect("Index.aspx");
            }
            else
            {
                ViewState["workCata"] = Request.QueryString["workCatagory"];
                ViewState["workArea"] = Request.QueryString["workArea"];
                ViewState["workYear"] = Request.QueryString["workYear"];
                ViewState["keyword"] = Request.QueryString["keyword"];
                SearchResumeManager srm = new SearchResumeManager();
                //绑定工作时间
                ddlWorkYear.DataSource = new baseConfigManager().getconfigInfo("工作时间");
                ddlWorkYear.DataTextField = "value";
                ddlWorkYear.DataValueField = "value";
                ddlWorkYear.DataBind();
                ddlWorkYear.Items.Insert(0, "--不限--");

                //绑定工作地点

                ddlArea.DataSource = new baseConfigManager().getconfigInfo("地点");
                ddlArea.DataTextField = "value";
                ddlArea.DataValueField = "value";
                ddlArea.DataBind();
                ddlArea.Items.Insert(0, "--不限--");

                //绑定职位
                ddlPro.DataSource = new baseConfigManager().getconfigInfo("职位");
                ddlPro.DataTextField = "value";
                ddlPro.DataValueField = "value";
                ddlPro.DataBind();
                ddlPro.Items.Insert(0, "--不限--");

                AspNetPager1.RecordCount = new SearchResumeManager().GetResumeCount(WorkCata, WorkArea, WorkYear, Keyword);
                DataBind(WorkCata, WorkArea, WorkYear, Keyword, 1);
            }
        }

    }
    private void DataBind(string workCata, string workArea, string workYear, string keyword, int pageIndex)
    {
        rpSearch.DataSource = new SearchResumeManager().GetResumeByPage(pageIndex, PageSize, workCata, workArea, workYear, keyword);
        rpSearch.DataBind();
        PageIndex = pageIndex;
    }
    protected void AspNetPager1_PageChanging(object src, PageChangingEventArgs e)
    {
        PageIndex = e.NewPageIndex;
        DataBind(WorkCata, WorkArea, WorkYear, Keyword, PageIndex);
    }

    protected void btnsreach_Click(object sender, ImageClickEventArgs e)
    {
        WorkArea = "";
        WorkCata = "";
        WorkYear = "";
        Keyword = Request.Form["keyword"];
        if (Keyword == "输入行业/技能关键字")
        {
            Keyword = "";
        }
        if (ddlArea.SelectedIndex != 0)
        {
            WorkArea = ddlArea.SelectedItem.Value;
        }
        if (ddlPro.SelectedIndex != 0)
        {
            WorkCata = ddlPro.SelectedItem.Value;
        }
        if (ddlWorkYear.SelectedIndex != 0)
        {
            WorkYear = ddlWorkYear.SelectedItem.Value;
        }
        AspNetPager1.RecordCount = new SearchResumeManager().GetResumeCount(WorkCata, WorkArea, WorkYear, Keyword);
        DataBind(WorkCata, WorkArea, WorkYear, Keyword, 1);
    }

    protected void rpSearch_ItemCommand(object source, RepeaterCommandEventArgs e)
    {

        if (e.CommandArgument.ToString() == "show")
        {
            HiddenField hfId = e.Item.FindControl("hfId") as HiddenField;
            if (!IsQyLogin())
            {
                JsWindows("企业用户请先登录", "");
            }
            Response.Redirect("ResumeShow.aspx?resumeId=" + hfId.Value);

        }
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="css/Admin_Style.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 970px; margin: 0 auto;" class="context">
        <div>
            <div style="height: 8px;">
            </div>
            <table>
                <tr>
                    <td>
                        <strong>人才搜索：</strong>&nbsp;
                    </td>
                    <td>
                        类别：<asp:DropDownList ID="ddlPro" runat="server" Width="100px">
                        </asp:DropDownList>
                    </td>
                    <td>
                        地点：<asp:DropDownList ID="ddlArea" runat="server" Width="100px">
                        </asp:DropDownList>
                    </td>
                    <td>
                        工作时间：<asp:DropDownList ID="ddlWorkYear" runat="server" Width="100px">
                        </asp:DropDownList>
                    </td>
                    <td>
                        关键字：<input maxlength="20" style="height: 20px; width: 149px;" type="text" name="keyword"
                            onblur="if(this.value=='') this.value='输入行业/技能关键字';" onfocus="if(this.value=='输入行业/技能关键字') this.value='';"
                            value="输入行业/技能关键字" />
                    </td>
                    <td>
                        <asp:ImageButton ID="btnsreach" runat="server" CssClass="txtBox" ImageUrl="~/img/17.gif"
                            OnClick="btnsreach_Click" />
                    </td>
                </tr>
            </table>
            <div >
                <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tableStyle">
                    <tr>
                        <td height="27" bgcolor="#3783FF" class="myqzzpTD">
                            搜索结果
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 56px; width: 100%">
                            <table width='100%' border='0' align='center' cellpadding='4' cellspacing='1' class='border'>
                                <tr class='topbg2'>
                                    <td width="8%" align="center">
                                        <strong class="Glow">编号</strong>
                                    </td>
                                    <td width="8%" align='center'>
                                        <strong class="Glow">性别</strong>
                                    </td>
                                    <td width="16%" align='center'>
                                        <strong class="Glow">工作时间</strong>
                                    </td>
                                    <td width="14%" align='center'>
                                        <strong class="Glow">工作类别</strong>
                                    </td>
                                    <td width="19%" align='center'>
                                        <strong class="Glow">精通技术</strong>
                                    </td>
                                    <td width="14%" align='center'>
                                        <strong class="Glow">意向工作地点</strong>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <asp:Repeater ID="rpSearch" runat="server">
                                    <ItemTemplate>
                                        <asp:Label ID="lblSearchResult" runat="server" Text="对不起，没有找到您想要的结果... ..." ForeColor="Red"
                                            Visible="false"></asp:Label>
                                        <tr>
                                            <td class="title_resumeList0">
                                                <%#Eval("id") %>
                                            </td>
                                            <td class="title_resumeList1">
                                                <%#Eval("sex") %>
                                            </td>
                                            <td class="title_resumeList2">
                                                <%#Eval("workYear") %>
                                            </td>
                                            <td class="title_resumeList3">
                                                <%#Eval("profession") %>
                                            </td>
                                            <td class="title_resumeList4">
                                                <%#Eval("Name") %>
                                            </td>
                                            <td class="title_resumeList5">
                                                <%#Eval("area") %>
                                            </td>
                                            <td>
                                                <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("Id") %>' />
                                                <asp:LinkButton ID="lbtnShow" runat="server" Text="查看详情" CommandArgument="show"></asp:LinkButton>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </table></FooterTemplate>
                                </asp:Repeater>
                            </table>
                        </td>
                    </tr>
                </table>
                <div style="text-align: right; width: 95%; line-height: 30px;">
                    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="最后一页"
                        NextPageText="下一页" PrevPageText="上一页" ShowBoxThreshold="20" PageSize="20" AlwaysShow="True"
                        OnPageChanging="AspNetPager1_PageChanging">
                    </webdiyer:AspNetPager>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
